
// const { Sequelize, DataTypes } = require("sequelize");
const { STRING, INTEGER } = require('../types')

module.exports = (sequelize) => {
  const user = sequelize.define(
    'user',
    {// 在这里定义模型属性
      id: {
        type: INTEGER,
        primaryKey:true,
        autoIncrement:true,
        allowNull:false
      },
      stuId: { // 学号
        type: STRING,
      },
      name: { // 姓名
        type: STRING,
      },
      password: { // 密码
        type: STRING,
      },
      class: { // 班级
        type: STRING,
      },
      avator: { // 头像
        type: STRING,
      },
      phone: { // 电话号码(账号)
        type: STRING,
        unique: true
      },
      role: {
        type: INTEGER,
      },
    }, 
    {
    tableName: "user",//直接提供表名
    timestamps: false
   }
  );
  return user
}
